import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
import { Cache } from "../cache/Cache";
type int = number;
//class SpaConfig
    
    export  class SpaConfig
    {
        constructor()
        {
            
            this.faceMap = new Map<any, any> /* flash.utils.Dictionary */();
            if (SpaConfig._instance != null) 
            {
                throw new Error(" SpaConfig 单例 ");
            }
            this.init();
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getObjectByFileName("spa.xml");
            this.write(loc1);
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc2=null;
            var loc1=arg1["face"]["item"] as Array<any>;
            var loc3=0;
            var loc4=loc1;
            for(loc2 of loc4) 
            {
                this.faceMap[loc2["interactType"] + "-" + loc2["playerSex"] + "-" + loc2["isSameSex"]] = loc2["fileName"];
            }
            return;
        }

        public getSpaInteractFace(arg1: int, arg2: Boolean): string
        {
            return this.faceMap[arg1 + "-" + Cache.instance.role.entityInfo.sex + "-" + arg2];
        }

        public static get instance(): SpaConfig
        {
            if (SpaConfig._instance == null) 
            {
                SpaConfig._instance = new SpaConfig();
            }
            return SpaConfig._instance;
        }

        public /* var */faceMap: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: SpaConfig;
    }
